import router from './router'

router.beforeEach((to, from, next) => {
  if (to.matched.some(record => record.meta.requireAuth)){ // 判断该路由是否需要登录权限
    if (sessionStorage.getItem('op-token')) { // 判断当前的token是否存在登录存入的token
      next();
    }else {
      next({
        path: 'login',
      })
    }
  }else {
    next();
  }
})